package com.atguigu.srb.exception;

import com.atguigu.srb.result.ResponseEnum;
import lombok.Getter;

/**
 * ClassName: SRBException
 * Package: com.atguigu.srb.exception
 * Description:
 *
 * @Author 刘强
 * @Create 2024/4/15 19:49
 * @Version 1.0
 */
// 自定义异常 : 来封装我们项目中抛出的 业务异常(业务异常信息都封装到响应结果的枚举类中)
@Getter
public class SRBException extends RuntimeException{
    private Integer code;
    private String message;

    public SRBException(String message, Integer code) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public SRBException(ResponseEnum responseEnum){
        this.code = responseEnum.getCode();
        this.message = responseEnum.getMessage();
    }

}
